package processor.impl;

import pojo.Command;
import processor.CommandProcessable;


/**
 * 命令处理实现类
 * @author WUJA13
 *
 */
public class CommandProcessableImpl implements CommandProcessable{

	@Override
	public Command dealWithCommand(String talk) {
//		System.out.println("talk = "+ talk);
		String[] strs = talk.split("\\s");
//		for(String item: strs)
//			System.out.println(item);
		if(strs.length<3)
			return null;
		if(!strs[0].matches("[LC]"))
			return null;
		if(!strs[1].matches("(xml|line)"))
				return null;
		if(!strs[2].matches("[a-zA-z]+"))
				return null;
		
		Command cmd = new Command();
		cmd.setHead(strs[0]);
		cmd.setOption(strs[1]);
		cmd.setOrderBy(strs[2]);
		
		return cmd;
	}

}
